package utils;

public class DataPair implements Comparable {

	private String word;
	private int quantity;

	public DataPair(String word, int quant) {
		this.word = word;
		quantity = quant;
	}

	public String toString() {
		return word + " , " + quantity;
	}

	@Override
	public int compareTo(Object arg0) {
		if (!(arg0 instanceof DataPair)) {
			System.out.println("Error in comparison");
			return -22;
		} else {
			DataPair t = (DataPair) arg0;
			if (t.quantity < quantity)
				return -1;
			if (t.quantity > quantity)
				return 1;

			return 0;
		}
	}

}
